import { bindActionCreators } from "redux";
import { useSelector, useDispatch } from "react-redux";
import { TestACs, State } from "../../../../state";

const Test = () => {
  const dispatch = useDispatch();
  const daily = useSelector((state: State) => state.test);
  const { depositMoney, withdrawMoney, bankrupt } = bindActionCreators(
    TestACs,
    dispatch
  );

  return (
    <>
      <h1>{daily}</h1>
      <button onClick={() => depositMoney(1000)}>deposite</button>
      <button onClick={() => withdrawMoney(1000)}>withdraw</button>
      <button onClick={() => bankrupt()}>bankrupt</button>
    </>
  );
};

export { Test };
